import request from '@/utils/request'

const baseURL = '/sysRoleApplication'

// 查询应用资源下的菜单树
export function queryApplicationMenu () {
  return request({
    url: `${baseURL}/queryApplicationMenu`
  })
}

// 角色绑定应用资源
export function batchByRoleApplication (data) {
  return request({
    url: `${baseURL}/batchByRoleApplication`,
    method: 'post',
    data
  })
}

// 查询当前用户设置的应用（顶部菜单）
export function loadUserIdByApplicationList () {
  return request({
    url: `${baseURL}/loadUserIdByApplicationList`,
  })
}

// 查询当前用户下某个应用下的菜单（左侧菜单)
export function loadApplicationIdByMenuList (applicationId) {
  return request({
    url: `${baseURL}/loadApplicationIdByMenuList`,
    params: {
      applicationId
    }
  })
}

// 根据角色ID查询已绑定的应用列表
export function loadRoleIdByApplicationList (roleId) {
  return request({
    url: `${baseURL}/loadRoleIdByApplicationList`,
    params: {
      id: roleId
    }
  })
}
